import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import { visualizer } from "rollup-plugin-visualizer";
// import commonjs from '@rollup/plugin-commonjs';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    // commonjs(),
    uni(),
    visualizer(),
  ],
  server: {
    proxy: {
      "/api": {
        target: "https://hxapi.yiniu.co",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
    port: 5100,
    fs: {
      // Allow serving files from one level up to the project root
      allow: [".."],
    },
  },
});
